#!/usr/bin/python
#coding=utf-8
import sys, datetime
from singleCost import *
from siresult.initCD0201 import *
from siresult.initCD0101 import *
from simo.initUninfo import *
from simo.initMO0101 import *
from simo.createPreQ112 import *
from simo.initMO0201 import *
from simo.TR0103 import *
from bzcbjs import *
from bzsjcb_0 import *
from writelog import *

if __name__ == '__main__':
    start = datetime.datetime.now()
    p_start_time = (start - datetime.timedelta(hours=3)).strftime("%Y%m%tmp_dict%H%M%S")
    p_end_time = start.strftime("%Y%m%tmp_dict%H%M%S")
    writelog('batch0test.py', start, 'start', '')
    param_info = 'start,'
    # p_start_time = '20210719200000'
    # p_end_time = '20210720200000'
    # code = singeCost('1001', 'Q314', 'MIHF', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q314', p_start_time, p_end_time, '0')
    #     MO0101('MIHF', 'Q314', p_start_time, p_end_time)
    #     MO0201('MIHF', 'Q314', start)
    # 四期机组
    # MO0101('MIBH', 'Q602', p_start_time, p_end_time)
    # code = singeCost('1001', 'Q602', 'MIBH', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q602', p_start_time, p_end_time, '0')
    #     MO0101('MIBH', 'Q602', p_start_time, p_end_time)
    #     MO0201('MIBH', 'Q602', start)
    # else:
    #     param_info = param_info + 'Q602_CODE=0,'
    # code = singeCost('1001', 'Q512', 'MIJA', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q512', p_start_time, p_end_time, '0')
    #     # MO0101('MIJA', 'Q512', p_start_time, p_end_time)
    #     MO0201('MIJA', 'Q512', start)
    # else:
    #     param_info = param_info + 'Q512_CODE=0,'
    # code = singeCost('1001', 'Q503', 'MIJC', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q503', p_start_time, p_end_time, '0')
    #     MO0101('MIJC', 'Q503', p_start_time, p_end_time)
    #     MO0201('MIJC', 'Q503', start)
    # else:
    #     param_info = param_info + 'Q503_CODE=0,'
    # code = singeCost('1001', 'Q414', 'MIJD', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q414', p_start_time, p_end_time, '0')
    #     MO0101('MIJD', 'Q414', p_start_time, p_end_time)
    #     MO0201('MIJD', 'Q414', start)
    # else:
    #     param_info = param_info + 'Q414_CODE=0,'


    # 三期机组
    # code = singeCost('1001', 'Q314', 'MIHF', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q314', p_start_time, p_end_time, '0')
    #     MO0101('MIHF', 'Q314', p_start_time, p_end_time)
    #     MO0201('MIHF', 'Q314', start)
    # else:
    #     param_info = param_info + 'Q314_CODE=0,'
    # code = singeCost('1001', 'Q412', 'MIHB', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q412', p_start_time, p_end_time, '0')
    #     # MO0101('MIHB', 'Q412', p_start_time, p_end_time)
    #     MO0201('MIHB', 'Q412', start)
    # else:
    #     param_info = param_info + 'Q412_CODE=0,'
    # MO0101('MIBD', 'Q402', p_start_time, p_end_time)
    code = singeCost('1001', 'Q402', 'MIBD', p_start_time, p_end_time, '0')
    if code == 1:
        singleCD0201('Q402', p_start_time, p_end_time, '0')
        MO0101('MIBD', 'Q402', p_start_time, p_end_time)
    # else:
    #     param_info = param_info + 'Q402_CODE=0,'
    # code = singeCost('1001', 'Q502', 'MIBE', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q502', p_start_time, p_end_time, '0')
    #     MO0101('MIBE', 'Q502', p_start_time, p_end_time)
    # else:
    #     param_info = param_info + 'Q502_CODE=0,'
    # code = singeCost('1001', 'Q403', 'MIHD', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q403', p_start_time, p_end_time, '0')
    #     MO0101('MIHD', 'Q403', p_start_time, p_end_time)
    # else:
    #     param_info = param_info + 'Q403_CODE=0,'
    # code = singeCost('1001', 'Q518', 'MIDE', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q518', p_start_time, p_end_time, '0')
    #     MO0101('MIDE', 'Q518', p_start_time, p_end_time)
    #     MO0201('MIDE', 'Q518', start)
    # else:
    #     param_info = param_info + 'Q518_CODE=0,'
    # code = singeCost('1001', 'Q161', 'MIDF', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q161_CODE=0,'
    # code = singeCost('1001', 'Q162', 'MIDG', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q162_CODE=0,'
    # code = singeCost('1001', 'Q163', 'MIDH', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q163_CODE=0,'
    # code = singeCost('1001', 'Q165', 'MIDJ', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q165_CODE=0,'
    # code = singeCost('1001', 'Q173', 'MIHH', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q173_CODE=0,'
    # code = singeCost('1001', 'Q174', 'MICK', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q174_CODE=0,'
    # code = singeCost('1001', 'Q175', 'MICL', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q175_CODE=0,'



    # 一期机组
    # code = singeCost('1001', 'C302', 'MIAC', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'C302_CODE=0,'
    # code = singeCost('1001', 'Q102', 'MIBA', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q102', p_start_time, p_end_time, '0')
    #     MO0101('MIBA', 'Q102', p_start_time, p_end_time)
    # else:
    #     param_info = param_info + 'Q102_CODE=0,'
    # code = singeCost('1001', 'Q202', 'MIBB', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q202', p_start_time, p_end_time, '0')
    #     MO0101('MIBB', 'Q202', p_start_time, p_end_time)
    # else:
    #     param_info = param_info + 'Q202_CODE=0,'
    # code = singeCost('1001', 'Q302', 'MIBC', p_start_time, p_end_time, '0')
    # if code == 1:
    #     singleCD0201('Q302', p_start_time, p_end_time, '0')
    #     MO0101('MIBC', 'Q302', p_start_time, p_end_time)
    # else:
    #     param_info = param_info + 'Q302_CODE=0,'
    # code = singeCost('1001', 'Q116', 'MIBF', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q116_CODE=0,'
    # code = singeCost('1001', 'Q216', 'MIBG', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q216_CODE=0,'
    # code = singeCost('1001', 'Q101', 'MIAB', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'Q101_CODE=0,'
    # code = singeCost('1001', 'H050', 'MIAA', p_start_time, p_end_time, '0')
    # if code == 0:
    #     param_info = param_info + 'H050_CODE=0,'

    # bzcbjs('1001', 'MIDN', '', p_start_time, p_end_time, '0')
    # bzcbjs('1001', 'MIDM', '', p_start_time, p_end_time, '0')
    # bzcbjs('1001', 'MIDY', '', p_start_time, p_end_time, '0')
    # bzcbjs('1001', 'MIDZ', '', p_start_time, p_end_time, '0')
    #
    # bzcbjs('1001', 'MICX', '', p_start_time, p_end_time, '0')
    # bzcbjs('1001', 'MIHY', '', p_start_time, p_end_time, '0')
    # bzcbjs('1001', 'MIHZ', '', p_start_time, p_end_time, '0')
    # bzcbjs('1001', 'MICZ', '', p_start_time, p_end_time, '0')

    # CD0101(p_start_time, p_end_time, '0')
    # UNINFO(p_start_time, p_end_time)
    #
    # bzsjcb_0('1001', p_start_time, p_end_time, '0')
    #
    # TR0103(p_start_time, p_end_time)
    writelog('batch0test.py', start, 'update', param_info)

    elapsed = float((datetime.datetime.now() - start).seconds)
    print("Time Used 4 All ----->>>> %f seconds" % (elapsed))

    sys.exit()